import 'package:flutter/material.dart';
import 'package:flutter_layout/config/env.dart';
import 'package:flutter_layout/config/router.dart';
import 'package:flutter_layout/config/theme.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  EnvConfig.init();

  runApp(const MainApp());
}

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
        designSize: const Size(375, 667), //设计图尺寸
        minTextAdapt: true, //字体自适应
        splitScreenMode: true, //是否开启屏幕适配
        builder: (context, child) {
          return MaterialApp.router(
            routerConfig: router,
            theme: AppTheme,
            themeMode: ThemeMode.light,
          );
        });

    // MaterialApp(
    //   home: IndexPage(),
    //   theme: AppTheme,
    //   themeMode: ThemeMode.light,
    // );
  }
}
